package cn.wolfcode.web.util;

import com.alibaba.fastjson.JSON;
import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.method.HandlerMethod;

import java.io.IOException;

public class UnauthorizedExceptionUtil {

    @ExceptionHandler(UnauthorizedException.class)
    public void handler(
            response, HandlerMethod method, UnauthorizedException e) throws IOException {
        if(method.getMethod().isAnnotationPresent(
                .class)){ resp onse.setContentType("text/json;charset=UTF-8");
            JSONResult result = new JSONResult();  result.mark("对不起，您没有权限执行该操作");  response.getWriter().print(JSON.toJSONString(result)); }el se{
            throw e;

}
